<!DOCTYPE html>
<html style="display: none;" lang="zh">
    <head>
    <meta charset="utf-8">
    <!--
        © Material Theme
        https://github.com/viosey/hexo-theme-material
        Version: 1.5.2 -->
    <script>
        window.materialVersion = "1.5.2"
        // Delete localstorage with these tags
        window.oldVersion = [
            'codestartv1',
            '1.3.4',
            '1.4.0',
            '1.4.0b1',
            '1.5.0'
        ]
    </script>

    <!-- dns prefetch -->
    <meta http-equiv="x-dns-prefetch-control" content="on">

    <link rel="dns-prefetch" href="https://cdn.jsdelivr.net/gh/viosey/hexo-theme-material/source"/>


    <link rel="dns-prefetch" href="https://cdn1.lncld.net"/>










    <link rel="dns-prefetch" href="https://cdn.con.sh"/>




    <!-- Meta & Info -->
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
    <meta name="renderer" content="webkit">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">

    <!-- Title -->
    
    <title>
        
            可能是最全的《如何在 VPS 上安装 Ghost 博客》教程 | 
        
        独立世界
    </title>

    <!-- Favicons -->
    <link rel="icon shortcut" type="image/ico" href="/img/favicon.png">
    <link rel="icon" href="/img/favicon.png">

    <meta name="format-detection" content="telephone=no"/>
    <meta name="description" itemprop="description" content="The independent world of YJK">
    <meta name="keywords" content=",Ghost,VPS">
    <meta name="theme-color" content="#0097A7">

    <!-- Disable Fucking Bloody Baidu Tranformation -->
    <meta http-equiv="Cache-Control" content="no-transform" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />

    <!--[if lte IE 9]>
        <link rel="stylesheet" href="/css/ie-blocker.css">

        
            <script src="/js/ie-blocker.zhCN.js"></script>
        
    <![endif]-->

    <!-- Import lsloader -->
    <script>(function(){window.lsloader={jsRunSequence:[],jsnamemap:{},cssnamemap:{}};lsloader.removeLS=function(a){try{localStorage.removeItem(a)}catch(b){}};lsloader.setLS=function(a,c){try{localStorage.setItem(a,c)}catch(b){}};lsloader.getLS=function(a){var c="";try{c=localStorage.getItem(a)}catch(b){c=""}return c};versionString="/*"+(window.materialVersion||"unknownVersion")+"*/";lsloader.clean=function(){try{var b=[];for(var a=0;a<localStorage.length;a++){b.push(localStorage.key(a))}b.forEach(function(e){var f=lsloader.getLS(e);if(window.oldVersion){var d=window.oldVersion.reduce(function(g,h){return g||f.indexOf("/*"+h+"*/")!==-1},false);if(d){lsloader.removeLS(e)}}})}catch(c){}};lsloader.clean();lsloader.load=function(f,a,b,d){if(typeof b==="boolean"){d=b;b=undefined}d=d||false;b=b||function(){};var e;e=this.getLS(f);if(e&&e.indexOf(versionString)===-1){this.removeLS(f);this.requestResource(f,a,b,d);return}if(e){var c=e.split(versionString)[0];if(c!=a){console.log("reload:"+a);this.removeLS(f);this.requestResource(f,a,b,d);return}e=e.split(versionString)[1];if(d){this.jsRunSequence.push({name:f,code:e});this.runjs(a,f,e)}else{document.getElementById(f).appendChild(document.createTextNode(e));b()}}else{this.requestResource(f,a,b,d)}};lsloader.requestResource=function(b,e,a,c){var d=this;if(c){this.iojs(e,b,function(h,f,g){d.setLS(f,h+versionString+g);d.runjs(h,f,g)})}else{this.iocss(e,b,function(f){document.getElementById(b).appendChild(document.createTextNode(f));d.setLS(b,e+versionString+f)},a)}};lsloader.iojs=function(d,b,g){var a=this;a.jsRunSequence.push({name:b,code:""});try{var f=new XMLHttpRequest();f.open("get",d,true);f.onreadystatechange=function(){if(f.readyState==4){if((f.status>=200&&f.status<300)||f.status==304){if(f.response!=""){g(d,b,f.response);return}}a.jsfallback(d,b)}};f.send(null)}catch(c){a.jsfallback(d,b)}};lsloader.iocss=function(f,c,h,a){var b=this;try{var g=new XMLHttpRequest();g.open("get",f,true);g.onreadystatechange=function(){if(g.readyState==4){if((g.status>=200&&g.status<300)||g.status==304){if(g.response!=""){h(g.response);a();return}}b.cssfallback(f,c,a)}};g.send(null)}catch(d){b.cssfallback(f,c,a)}};lsloader.iofonts=function(f,c,h,a){var b=this;try{var g=new XMLHttpRequest();g.open("get",f,true);g.onreadystatechange=function(){if(g.readyState==4){if((g.status>=200&&g.status<300)||g.status==304){if(g.response!=""){h(g.response);a();return}}b.cssfallback(f,c,a)}};g.send(null)}catch(d){b.cssfallback(f,c,a)}};lsloader.runjs=function(f,c,e){if(!!c&&!!e){for(var b in this.jsRunSequence){if(this.jsRunSequence[b].name==c){this.jsRunSequence[b].code=e}}}if(!!this.jsRunSequence[0]&&!!this.jsRunSequence[0].code&&this.jsRunSequence[0].status!="failed"){var a=document.createElement("script");a.appendChild(document.createTextNode(this.jsRunSequence[0].code));a.type="text/javascript";document.getElementsByTagName("head")[0].appendChild(a);this.jsRunSequence.shift();if(this.jsRunSequence.length>0){this.runjs()}}else{if(!!this.jsRunSequence[0]&&this.jsRunSequence[0].status=="failed"){var d=this;var a=document.createElement("script");a.src=this.jsRunSequence[0].path;a.type="text/javascript";this.jsRunSequence[0].status="loading";a.onload=function(){d.jsRunSequence.shift();if(d.jsRunSequence.length>0){d.runjs()}};document.body.appendChild(a)}}};lsloader.tagLoad=function(b,a){this.jsRunSequence.push({name:a,code:"",path:b,status:"failed"});this.runjs()};lsloader.jsfallback=function(c,b){if(!!this.jsnamemap[b]){return}else{this.jsnamemap[b]=b}for(var a in this.jsRunSequence){if(this.jsRunSequence[a].name==b){this.jsRunSequence[a].code="";this.jsRunSequence[a].status="failed";this.jsRunSequence[a].path=c}}this.runjs()};lsloader.cssfallback=function(e,c,b){if(!!this.cssnamemap[c]){return}else{this.cssnamemap[c]=1}var d=document.createElement("link");d.type="text/css";d.href=e;d.rel="stylesheet";d.onload=d.onerror=b;var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(d,a)};lsloader.runInlineScript=function(c,b){var a=document.getElementById(b).innerText;this.jsRunSequence.push({name:c,code:a});this.runjs()}})();</script>

    <!-- Import queue -->
    <script>function Queue(){this.dataStore=[];this.offer=b;this.poll=d;this.execNext=a;this.debug=false;this.startDebug=c;function b(e){if(this.debug){console.log("Offered a Queued Function.")}if(typeof e==="function"){this.dataStore.push(e)}else{console.log("You must offer a function.")}}function d(){if(this.debug){console.log("Polled a Queued Function.")}return this.dataStore.shift()}function a(){var e=this.poll();if(e!==undefined){if(this.debug){console.log("Run a Queued Function.")}e()}}function c(){this.debug=true}}var queue=new Queue();</script>

    <!-- Import CSS -->
    
        <style id="material_css"></style><script>if(typeof window.lsLoadCSSMaxNums === "undefined")window.lsLoadCSSMaxNums = 0;window.lsLoadCSSMaxNums++;lsloader.load("material_css","https://cdn.jsdelivr.net/gh/viosey/hexo-theme-material/source/css/material.min.css",function(){if(typeof window.lsLoadCSSNums === "undefined")window.lsLoadCSSNums = 0;window.lsLoadCSSNums++;if(window.lsLoadCSSNums == window.lsLoadCSSMaxNums)document.documentElement.style.display="";}, false)</script>
        <style id="style_css"></style><script>if(typeof window.lsLoadCSSMaxNums === "undefined")window.lsLoadCSSMaxNums = 0;window.lsLoadCSSMaxNums++;lsloader.load("style_css","https://cdn.jsdelivr.net/gh/viosey/hexo-theme-material/source/css/style.min.css",function(){if(typeof window.lsLoadCSSNums === "undefined")window.lsLoadCSSNums = 0;window.lsLoadCSSNums++;if(window.lsLoadCSSNums == window.lsLoadCSSMaxNums)document.documentElement.style.display="";}, false)</script>

        
            
                <style id="prettify_css"></style><script>if(typeof window.lsLoadCSSMaxNums === "undefined")window.lsLoadCSSMaxNums = 0;window.lsLoadCSSMaxNums++;lsloader.load("prettify_css","https://cdn.jsdelivr.net/gh/viosey/hexo-theme-material/source/css/prettify.min.css",function(){if(typeof window.lsLoadCSSNums === "undefined")window.lsLoadCSSNums = 0;window.lsLoadCSSNums++;if(window.lsLoadCSSNums == window.lsLoadCSSMaxNums)document.documentElement.style.display="";}, false)</script>
                <style id="prettify_theme"></style><script>if(typeof window.lsLoadCSSMaxNums === "undefined")window.lsLoadCSSMaxNums = 0;window.lsLoadCSSMaxNums++;lsloader.load("prettify_theme","https://cdn.jsdelivr.net/gh/viosey/hexo-theme-material/source/css/prettify/github-v2.min.css",function(){if(typeof window.lsLoadCSSNums === "undefined")window.lsLoadCSSNums = 0;window.lsLoadCSSNums++;if(window.lsLoadCSSNums == window.lsLoadCSSMaxNums)document.documentElement.style.display="";}, false)</script>
            
        

    

    

    <!-- Config CSS -->

<!-- Other Styles -->
<style>
  body, html {
    font-family: Roboto, "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
    overflow-x: hidden !important;
  }
  
  code {
    font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
  }

  a {
    color: #00838F;
  }

  .mdl-card__media,
  #search-label,
  #search-form-label:after,
  #scheme-Paradox .hot_tags-count,
  #scheme-Paradox .sidebar_archives-count,
  #scheme-Paradox .sidebar-colored .sidebar-header,
  #scheme-Paradox .sidebar-colored .sidebar-badge{
    background-color: #0097A7 !important;
  }

  /* Sidebar User Drop Down Menu Text Color */
  #scheme-Paradox .sidebar-colored .sidebar-nav>.dropdown>.dropdown-menu>li>a:hover,
  #scheme-Paradox .sidebar-colored .sidebar-nav>.dropdown>.dropdown-menu>li>a:focus {
    color: #0097A7 !important;
  }

  #post_entry-right-info,
  .sidebar-colored .sidebar-nav li:hover > a,
  .sidebar-colored .sidebar-nav li:hover > a i,
  .sidebar-colored .sidebar-nav li > a:hover,
  .sidebar-colored .sidebar-nav li > a:hover i,
  .sidebar-colored .sidebar-nav li > a:focus i,
  .sidebar-colored .sidebar-nav > .open > a,
  .sidebar-colored .sidebar-nav > .open > a:hover,
  .sidebar-colored .sidebar-nav > .open > a:focus,
  #ds-reset #ds-ctx .ds-ctx-entry .ds-ctx-head a {
    color: #0097A7 !important;
  }

  .toTop {
    background: #757575 !important;
  }

  .material-layout .material-post>.material-nav,
  .material-layout .material-index>.material-nav,
  .material-nav a {
    color: #757575;
  }

  #scheme-Paradox .MD-burger-layer {
    background-color: #757575;
  }

  #scheme-Paradox #post-toc-trigger-btn {
    color: #757575;
  }

  .post-toc a:hover {
    color: #00838F;
    text-decoration: underline;
  }

</style>


<!-- Theme Background Related-->

    <style>
      body{
        background-color: #F5F5F5;
      }

      /* blog_info bottom background */
      #scheme-Paradox .material-layout .something-else .mdl-card__supporting-text{
        background-color: #fff;
      }
    </style>




<!-- Fade Effect -->

    <style>
      .fade {
        transition: all 800ms linear;
        -webkit-transform: translate3d(0,0,0);
        -moz-transform: translate3d(0,0,0);
        -ms-transform: translate3d(0,0,0);
        -o-transform: translate3d(0,0,0);
        transform: translate3d(0,0,0);
        opacity: 1;
      }

      .fade.out{
        opacity: 0;
      }
    </style>


<!-- Import Font -->
<!-- Import Roboto -->

    <link href="https://cdn.con.sh/css?family=Roboto:300,400,500" rel="stylesheet">


<!-- Import Material Icons -->


    <style id="material_icons"></style><script>if(typeof window.lsLoadCSSMaxNums === "undefined")window.lsLoadCSSMaxNums = 0;window.lsLoadCSSMaxNums++;lsloader.load("material_icons","https://cdn.jsdelivr.net/gh/viosey/hexo-theme-material/source/css/material-icons.css",function(){if(typeof window.lsLoadCSSNums === "undefined")window.lsLoadCSSNums = 0;window.lsLoadCSSNums++;if(window.lsLoadCSSNums == window.lsLoadCSSMaxNums)document.documentElement.style.display="";}, false)</script>




    <!-- Import jQuery -->
    
        <script>lsloader.load("jq_js","https://cdn.jsdelivr.net/npm/jquery@2.2.1/dist/jquery.min.js", true)</script>
    

    <!-- WebAPP Icons -->
    <meta name="mobile-web-app-capable" content="yes">
    <meta name="application-name" content="独立世界">
    <meta name="msapplication-starturl" content="https://yjk.im/how-to-install-ghost-on-vps/">
    <meta name="msapplication-navbutton-color" content="#0097A7">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-title" content="独立世界">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon" href="/img/favicon.png">

    <!-- Site Verification -->
    
    

    <!-- RSS -->
    
        
            <link rel=alternate type="application/atom+xml" href="/atom.xml">
        
    

    <!-- The Open Graph protocol -->
    <meta property="og:url" content="https://yjk.im/how-to-install-ghost-on-vps/">
    <meta property="og:type" content="blog">
    <meta property="og:title" content="可能是最全的《如何在 VPS 上安装 Ghost 博客》教程 | 独立世界">
    <meta property="og:image" content="/img/favicon.png">
    <meta property="og:description" content="The independent world of YJK">
    <meta property="og:article:tag" content="Ghost"> <meta property="og:article:tag" content="VPS"> 

    
        <meta property="article:published_time" content="Tue Jan 26 2016 16:01:49 GMT+0800">
        <meta property="article:modified_time" content="Wed Dec 13 2017 16:25:35 GMT+0800">
    

    <!-- The Twitter Card protocol -->
    <meta name="twitter:card" content="summary_large_image">

    <!-- Add canonical link for SEO -->
    
        <link rel="canonical" href="https://yjk.im/how-to-install-ghost-on-vps/index.html" />
    

    <!-- Structured-data for SEO -->
    
        


<script type="application/ld+json">
{
    "@context": "https://schema.org",
    "@type": "BlogPosting",
    "mainEntityOfPage": "https://yjk.im/how-to-install-ghost-on-vps/index.html",
    "headline": "可能是最全的《如何在 VPS 上安装 Ghost 博客》教程",
    "datePublished": "Tue Jan 26 2016 16:01:49 GMT+0800",
    "dateModified": "Wed Dec 13 2017 16:25:35 GMT+0800",
    "author": {
        "@type": "Person",
        "name": "YJK",
        "image": {
            "@type": "ImageObject",
            "url": "https://v5cdn.b0.upaiyun.com/avatar/5c1963a15ab57f2af68e9ecf6693fbac"
        },
        "description": "Independent World"
    },
    "publisher": {
        "@type": "Organization",
        "name": "独立世界",
        "logo": {
            "@type":"ImageObject",
            "url": "/img/favicon.png"
        }
    },
    "keywords": ",Ghost,VPS",
    "description": "The independent world of YJK",
}
</script>


    

    <!-- Analytics -->
    
    
    

    <!-- Custom Head -->
    

</head>


    
        <body id="scheme-Paradox" class="lazy">
            <div class="material-layout  mdl-js-layout has-drawer is-upgraded">
                

                <!-- Main Container -->
                <main class="material-layout__content" id="main">

                    <!-- Top Anchor -->
                    <div id="top"></div>

                    
                        <!-- Hamburger Button -->
                        <button class="MD-burger-icon sidebar-toggle">
                            <span class="MD-burger-layer"></span>
                        </button>
                    

                    <!-- Post TOC -->

    
    <!-- Back Button -->
    <!--
    <div class="material-back" id="backhome-div" tabindex="0">
        <a class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon"
           href="#" onclick="window.history.back();return false;"
           target="_self"
           role="button"
           data-upgraded=",MaterialButton,MaterialRipple">
            <i class="material-icons" role="presentation">arrow_back</i>
            <span class="mdl-button__ripple-container">
                <span class="mdl-ripple"></span>
            </span>
        </a>
    </div>
    -->


    <!-- Left aligned menu below button -->
    
    
    <button id="post-toc-trigger-btn"
        class="mdl-button mdl-js-button mdl-button--icon">
        <i class="material-icons">format_list_numbered</i>
    </button>

    <ul class="post-toc-wrap mdl-menu mdl-menu--bottom-left mdl-js-menu mdl-js-ripple-effect" for="post-toc-trigger-btn" style="max-height:80vh; overflow-y:scroll;">
        <ol class="post-toc"><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#安装-Node-js"><span class="post-toc-number">1.</span> <span class="post-toc-text"><a href="#&#x5B89;&#x88C5;-Node-js" class="headerlink" title="&#x5B89;&#x88C5; Node.js"></a>&#x5B89;&#x88C5; Node.js</span></a></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#安装-Ghost"><span class="post-toc-number">2.</span> <span class="post-toc-text"><a href="#&#x5B89;&#x88C5;-Ghost" class="headerlink" title="&#x5B89;&#x88C5; Ghost"></a>&#x5B89;&#x88C5; Ghost</span></a></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#安装-Nginx"><span class="post-toc-number">3.</span> <span class="post-toc-text"><a href="#&#x5B89;&#x88C5;-Nginx" class="headerlink" title="&#x5B89;&#x88C5; Nginx"></a>&#x5B89;&#x88C5; Nginx</span></a></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#高级配置"><span class="post-toc-number">4.</span> <span class="post-toc-text"><a href="#&#x9AD8;&#x7EA7;&#x914D;&#x7F6E;" class="headerlink" title="&#x9AD8;&#x7EA7;&#x914D;&#x7F6E;"></a>&#x9AD8;&#x7EA7;&#x914D;&#x7F6E;</span></a><ol class="post-toc-child"><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#4、配置-SSL"><span class="post-toc-number">4.1.</span> <span class="post-toc-text"><a href="#4&#x3001;&#x914D;&#x7F6E;-SSL" class="headerlink" title="4&#x3001;&#x914D;&#x7F6E; SSL"></a>4&#x3001;&#x914D;&#x7F6E; SSL</span></a></li><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#5、配置-Mysql-数据库"><span class="post-toc-number">4.2.</span> <span class="post-toc-text"><a href="#5&#x3001;&#x914D;&#x7F6E;-Mysql-&#x6570;&#x636E;&#x5E93;" class="headerlink" title="5&#x3001;&#x914D;&#x7F6E; Mysql &#x6570;&#x636E;&#x5E93;"></a>5&#x3001;&#x914D;&#x7F6E; Mysql &#x6570;&#x636E;&#x5E93;</span></a></li><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#6、找回密码-amp-配置邮件"><span class="post-toc-number">4.3.</span> <span class="post-toc-text"><a href="#6&#x3001;&#x627E;&#x56DE;&#x5BC6;&#x7801;-amp-&#x914D;&#x7F6E;&#x90AE;&#x4EF6;" class="headerlink" title="6&#x3001;&#x627E;&#x56DE;&#x5BC6;&#x7801;&amp;&#x914D;&#x7F6E;&#x90AE;&#x4EF6;"></a>6&#x3001;&#x627E;&#x56DE;&#x5BC6;&#x7801;&amp;&#x914D;&#x7F6E;&#x90AE;&#x4EF6;</span></a></li><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#7、安装主题"><span class="post-toc-number">4.4.</span> <span class="post-toc-text"><a href="#7&#x3001;&#x5B89;&#x88C5;&#x4E3B;&#x9898;" class="headerlink" title="7&#x3001;&#x5B89;&#x88C5;&#x4E3B;&#x9898;"></a>7&#x3001;&#x5B89;&#x88C5;&#x4E3B;&#x9898;</span></a></li></ol></li></ol>
    </ul>
    




<!-- Layouts -->

    <!-- Post Module -->
    <div class="material-post_container">

        <div class="material-post mdl-grid">
            <div class="mdl-card mdl-shadow--4dp mdl-cell mdl-cell--12-col">

                <!-- Post Header(Thumbnail & Title) -->
                
    <!-- Paradox Post Header -->
    
        <!-- Custom Thumbnail -->
        <div class="post_thumbnail-custom mdl-card__media mdl-color-text--grey-50" style="background-image:url(/i/ghost.png)">
    
            <p class="article-headline-p">
                可能是最全的《如何在 VPS 上安装 Ghost 博客》教程
            </p>
        </div>





                
                    <!-- Paradox Post Info -->
                    <div class="mdl-color-text--grey-700 mdl-card__supporting-text meta">

    <!-- Author Avatar -->
    <div id="author-avatar">
        <img src="https://v5cdn.b0.upaiyun.com/avatar/5c1963a15ab57f2af68e9ecf6693fbac" width="44px" height="44px" alt="Author Avatar"/>
    </div>
    <!-- Author Name & Date -->
    <div>
        <strong>YJK</strong>
        <span>1月 26, 2016</span>
    </div>

    <div class="section-spacer"></div>

    <!-- Favorite -->
    <!--
        <button id="article-functions-like-button" class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon btn-like">
            <i class="material-icons" role="presentation">favorite</i>
            <span class="visuallyhidden">favorites</span>
        </button>
    -->

    <!-- Qrcode -->
    
        <button id="article-functions-qrcode-button" class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon">
    <i class="material-icons" role="presentation">devices other</i>
    <span class="visuallyhidden">devices other</span>
</button>
<ul class="mdl-menu mdl-menu--bottom-right mdl-js-menu mdl-js-ripple-effect" for="article-functions-qrcode-button">
    <li class="mdl-menu__item">在其它设备中阅读本文章</li>
    
        <img src="">
    
</ul>

    

    <!-- Tags (bookmark) -->
    
    <button id="article-functions-viewtags-button" class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon">
        <i class="material-icons" role="presentation">bookmark</i>
        <span class="visuallyhidden">bookmark</span>
    </button>
    <ul class="mdl-menu mdl-menu--bottom-right mdl-js-menu mdl-js-ripple-effect" for="article-functions-viewtags-button">
        <li class="mdl-menu__item">
        <a class="post_tag-link" href="/tags/Ghost/">Ghost</a></li><li class="mdl-menu__item"><a class="post_tag-link" href="/tags/VPS/">VPS</a>
    </ul>
    

    <!-- Share -->
    
        <button id="article-fuctions-share-button" class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon">
    <i class="material-icons" role="presentation">share</i>
    <span class="visuallyhidden">share</span>
</button>
<ul class="mdl-menu mdl-menu--bottom-right mdl-js-menu mdl-js-ripple-effect" for="article-fuctions-share-button">
    
    <!-- Leancloud Views -->
        <a class="post_share-link" href="#">
            <li class="mdl-menu__item">
                <span id="/how-to-install-ghost-on-vps/" class="leancloud-views_num" data-flag-title="可能是最全的《如何在 VPS 上安装 Ghost 博客》教程">
     &nbsp;浏览量
</span>

            </li>
        </a>
    

    

    <!-- Share Weibo -->
    

    <!-- Share Twitter -->
    

    <!-- Share Facebook -->
    

    <!-- Share Google+ -->
    

    <!-- Share LinkedIn -->
    

    <!-- Share QQ -->
    

    <!-- Share Telegram -->
    
</ul>

    
</div>

                

                <!-- Post Content -->
                <div id="post-content" class="mdl-color-text--grey-700 mdl-card__supporting-text fade out">
    
        <p><strong>目录</strong></p>
<ul>
<li><strong>必要配置</strong>：</li>
<li>1、安装 Node.js</li>
<li>2、安装 Ghost</li>
<li>3、安装 Nginx</li>
<li><strong>高级配置</strong>：</li>
<li>4、配置 SSL</li>
<li>5、配置 Mysql 数据库</li>
<li>6、找回密码&amp;配置邮件</li>
<li>7、安装主题</li>
</ul>
<blockquote>
<p>推荐使用 Debian 8 x64 的系统， VPS 内存大于 1G</p>
</blockquote>
<h2 id="安装-Node-js"><a href="#安装-Node-js" class="headerlink" title="安装 Node.js"></a>安装 Node.js</h2><p>目前 Node.js 稳定版的版本号为 v4.2.4 ，安装方法如下：</p>
<blockquote>
<p>以下命令均需 root 权限，若您不是以 root 用户登录 VPS 的，请在执行命令前运行 <code>su</code>。若是你不知道 root 用户密码，你可以试试运行 <code>sudo passwd root</code> 来设置一个</p>
</blockquote>
<p>For Debian/Ubuntu</p>
<pre><code>apt-get update &amp;&amp; apt-get install curl wget unzip vim -y &amp;&amp; curl -sL https://deb.nodesource.com/setup_4.x | bash - &amp;&amp; apt-get install -y nodejs build-essential
</code></pre><p>For Centos</p>
<pre><code>yum update &amp;&amp; yum install curl wget unzip vim -y &amp;&amp; curl --silent --location https://rpm.nodesource.com/setup_4.x | bash - &amp;&amp; yum install gcc-c++ make nodejs -y
</code></pre><h2 id="安装-Ghost"><a href="#安装-Ghost" class="headerlink" title="安装 Ghost"></a>安装 Ghost</h2><p>目前 Ghost 版本为 v0.7.5 ，安装方法如下：</p>
<p>进入 <code>/home</code> 目录，下载 Ghost 安装包并安装：</p>
<pre><code>cd /home &amp;&amp; mkdir ghost &amp;&amp; cd ghost &amp;&amp; curl -L https://github.com/TryGhost/Ghost/releases/download/0.7.5/Ghost-0.7.5.zip -o ghost.zip &amp;&amp; unzip ghost.zip &amp;&amp; npm install --production
</code></pre><p>然后修改 <code>config.js</code> ：</p>
<pre><code>cp config.example.js config.js &amp;&amp; vim config.js
</code></pre><p>按 <code>i</code> ，修改相应内容：</p>
<pre><code>production: {
        url: &#39;http://my-ghost-blog.com&#39;, // 修改为您自己的域名
        mail: {},
        database: {
            client: &#39;sqlite3&#39;, // 若您是国外小内存 VPS 推荐使用默认sqlite3数据库
            connection: {
                filename: path.join(__dirname, &#39;/content/data/ghost.db&#39;)
            },
            debug: false
        },

        server: {
            host: &#39;127.0.0.1&#39;, // 修改为 0.0.0.0
            port: &#39;2368&#39; // 推荐修改为大于5000的端口
        }
    },
</code></pre><p><a href="#5mysql">使用 Mysql 数据库请查看此</a></p>
<p>修改完后，按 esc 键，并输入 <code>:wq</code> 回车保存并关闭</p>
<p>然后运行 <code>npm start</code> </p>
<p>若出现：</p>
<pre><code>Listening on 0.0.0.0:8080
Url configured as: http://yourdomain
Ctrl+C to shut down
</code></pre><p>则代表运行成功，按 Ctrl + C 键退出运行</p>
<p>安装 PM2 ：</p>
<pre><code>npm install -g pm2
</code></pre><p>用 PM2 来守护 Ghost 运行：</p>
<pre><code>NODE_ENV=production pm2 start index.js
</code></pre><p>再运行 <code>pm2 startup 0</code> 使它开机运行</p>
<p>这样 Ghost 博客变安装并运行成功了</p>
<h2 id="安装-Nginx"><a href="#安装-Nginx" class="headerlink" title="安装 Nginx"></a>安装 Nginx</h2><p>For Debian/Ubuntu</p>
<pre><code>curl -L http://nginx.org/keys/nginx_signing.key -o nginx_signing.key &amp;&amp; apt-key add nginx_signing.key &amp;&amp; vim /etc/apt/sources.list
</code></pre><p>按 <code>i</code> 新增两行：</p>
<pre><code>// For Debian
deb http://nginx.org/packages/mainline/debian/ *codename* nginx
deb-src http://nginx.org/packages/mainline/debian/ *codename* nginx

// For Ubuntu
deb http://nginx.org/packages/mainline/ubuntu/ *codename* nginx
deb-src http://nginx.org/packages/mainline/ubuntu/ *codename* nginx

//将上方 *codename* 替换成对应系统的代号： Debian7: wheezy; Debian8: jessie; Ubuntu12.04: precise; Ubuntu14.04: trusty; Ubuntu15.04: vivid; Ubuntu15.10: wily;
</code></pre><p>按 esc 键，输入 <code>:wq</code> 回车，并继续运行：</p>
<pre><code>apt-get update &amp;&amp; apt-get install nginx -y
</code></pre><p>For Centos</p>
<pre><code>vim /etc/yum.repos.d/nginx.repo
</code></pre><p>按 <code>i</code> 粘贴下方内容：</p>
<pre><code>[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/*OSRELEASE*/$basearch/ 
gpgcheck=0
enabled=1

// 修改上方 *OSRELEASE* 为您系统版本： centos 5.x: 5; centos 6.x: 6; centos 7.x: 7;
</code></pre><p>按 esc 键，输入 <code>:wq</code> 回车，并继续运行：</p>
<pre><code>yum update &amp;&amp; yum install -y nginx
</code></pre><p>运行 <code>nginx -v</code> 若出现 Nginx 版本号 则代表安装成功</p>
<p>然后新建一个 Nginx 配置文件：</p>
<pre><code>vim /etc/nginx/conf.d/ghost.conf
</code></pre><p>按 <code>i</code> 粘贴下方内容：</p>
<pre><code>server {
    listen 0.0.0.0:80;
    # 将 *your-domain-name* 更换为您的域名
    server_name *your-domain-name*; 
    access_log /var/log/nginx/*your-domain-name*.log; 

    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header HOST $http_host;
        proxy_set_header X-NginX-Proxy true;
        # 若您之前更改过 Ghost 运行端口，则将 2368 改为您更改过后的端口
        proxy_pass http://127.0.0.1:2368; 
        proxy_redirect off;
    }
</code></pre><p>按 esc 键，输入 <code>:wq</code> 回车，并继续运行：</p>
<pre><code>service nginx restart
</code></pre><p>若出现 <code>Restarting nginx: nginx.</code> 则代表 Nginx 配置成功</p>
<p>将您的域名的 A 记录指向您 VPS 的 IP ，然后访问您的域名，出现 Ghost 默认首页即代表您的 Ghost 博客安装成功了，访问 <code>http://yourdomain/ghost</code> 注册成为您博客的主人吧。</p>
<hr>
<h2 id="高级配置"><a href="#高级配置" class="headerlink" title="高级配置"></a>高级配置</h2><hr>
<h3 id="4、配置-SSL"><a href="#4、配置-SSL" class="headerlink" title="4、配置 SSL"></a>4、配置 SSL</h3><p>首先你需要为你的域名签发一个 SSL 证书，这里推荐 <a href="https://startssl.com" target="_blank" rel="noopener">StartSSL</a> 它可以为你签订免费的受信任的 SSL 证书（但不支持 XP 系统）</p>
<p>获取了 SSL 证书后，将 crt 及 key 文件放入 <code>/etc/nginx/ssl</code> 中，然后编辑 Nginx 配置文件</p>
<pre><code>vim /etc/nginx/conf.d/ghost.conf
</code></pre><p>更新为以下配置</p>
<pre><code>server {
    listen 80;
    # 将 *yourdomain* 更换为你自己的域名
    server_name *yourdomain* ;

    return 301 https://$server_name$request_uri;
}

server {
    # Nginx 1.9.5 以上支持 http2 协议，若您的 Nginx 版本低于此请将 http2 去掉
    listen 443 ssl http2;
    # 将 *yourdomain* 更换为你自己的域名
    server_name *yourdomain* ;

    ssl on;
    # 更换成你证书的名称
    ssl_certificate /etc/nginx/ssl/yourdomain.crt;
    ssl_certificate_key /etc/nginx/ssl/yourdomain.key;

    # enables all versions of TLS, but not SSLv2 or 3 which are weak and now deprecated.
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

    # disables all weak ciphers
    ssl_ciphers &#39;AES128+EECDH:AES128+EDH&#39;;

    ssl_prefer_server_ciphers on;

    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;

        proxy_pass http://127.0.0.1:5000/;
        # 将 5000 端口换成你设置的端口
        proxy_redirect off;
    }

    # 让 Nginx 直接分发 Ghost 中的静态文件
    location /content/images {  
       alias /home/ghost/content/images;
       expires max;
    }

    #将 *your theme name* 更换成你主题名称
    location /assets {  
       alias /home/ghost/content/themes/*your theme name*/assets;
       expires max;
    }

    location /shared {  
       alias /home/ghost/core/shared;
       expires max;
    }

    location /ghost/scripts {  
       alias /home/ghost/core/built/scripts;
       expires max;
    }
}
</code></pre><p>然后重启 Nginx </p>
<pre><code>service nginx restart
</code></pre><hr>
<h3 id="5、配置-Mysql-数据库"><a href="#5、配置-Mysql-数据库" class="headerlink" title="5、配置 Mysql 数据库"></a>5、配置 Mysql 数据库</h3><blockquote>
<p>若您之前已经在 sqlite 模式下书写了博客，请访问博客后台 - <code>Labs</code> - <code>Export</code> 按钮来导出博客数据，配置完 mysql 数据库后再在 <code>Labs</code> 内导入之前的博客数据</p>
</blockquote>
<hr>
<p><strong>For Debian/Ubuntu</strong></p>
<p>同理，若使用非 root 帐号登录，先运行 <code>su</code> 获取 root 权限再执行以下操作：</p>
<pre><code>apt-get install mysql-server mysql-client  -y
</code></pre><p>安装过程中，系统会提示你给 root 用户（这里的 root 是 MySQL 数据库的管理账号） 设置个密码，建议设置足够复杂的密码（例如：cqmylightysdss / 床前明月光疑是地上霜）</p>
<p>MySQL 安装成功后，执行以下指令进一步加强 MySQL 的安全设置：</p>
<pre><code>mysql_secure_installation  
</code></pre><hr>
<pre><code>NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL  SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we&#39;ll need the current  
password for the root user.  If you&#39;ve just installed MySQL, and  
you haven&#39;t set the root password yet, the password will be blank,  
so you should just press enter here.

//输入安装 MySQL 时为 root 账户设置的密码
Enter current password for root (enter for none):  
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL  
root user without the proper authorisation.

You already have a root password set, so you can safely answer &#39;n&#39;.

//是否修改 root 账户的密码？前面设置过 root 账户的密码了，如果不打算修改密码的话，输入 &#39;n&#39;
Change the root password? [Y/n] n  
 ... skipping.

By default, a MySQL installation has an anonymous user, allowing anyone  
to log into MySQL without having to have a user account created for  
them.  This is intended only for testing, and to make the installation  
go a bit smoother.  You should remove them before moving into a  
production environment.

//是否删除匿名用户？
Remove anonymous users? [Y/n] y  
 ... Success!

Normally, root should only be allowed to connect from &#39;localhost&#39;.  This  
ensures that someone cannot guess at the root password from the network.

//是否禁止 root 账户远程登录？
Disallow root login remotely? [Y/n] y  
 ... Success!

By default, MySQL comes with a database named &#39;test&#39; that anyone can  
access.  This is also intended only for testing, and should be removed  
before moving into a production environment.

//是否删除 MySQL 默认创建的 test 数据库，并删除所有对 test 数据库的权限设置？
Remove test database and access to it? [Y/n] y  
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far  
will take effect immediately.

//是否重新加载权限表？
Reload privilege tables now? [Y/n] y  
 ... Success!

Cleaning up...

All done!  If you&#39;ve completed all of the above steps, your MySQL  
installation should now be secure.

Thanks for using MySQL!
</code></pre><p>为 MySQL 设置默认字符集：</p>
<pre><code>vim /etc/mysql/my.cnf
</code></pre><p>为 <code>[mysqld]</code> 添加如下设置：</p>
<pre><code>[mysqld]
collation-server = utf8_unicode_ci  
init-connect=&#39;SET NAMES utf8&#39;  
character-set-server = utf8
</code></pre><p>重启 MySQL：</p>
<pre><code>service mysqld restart
</code></pre><p>创建一个 MySQL 数据库：</p>
<pre><code>mysql -uroot -p -e &#39;create database ghost;&#39;  
</code></pre><p>系统会提示你输入 MySQL 数据库的 <code>root</code> 账户密码，然后编辑 Ghost 博客的配置文件：</p>
<pre><code>cd /home/ghost/ //进入之前安装 Ghost 博客的目录
vim config.js  
</code></pre><p>按 <code>i</code> ，修改 production 中数据库的配置：</p>
<pre><code>production: {
        url: &#39;*yourdomain&#39;, // 替换为你自己的域名。
        mail: {},
        database: {
             // client: &#39;sqlite3&#39;, // 若您是国外小内存 VPS 推荐使用默认sqlite3数据库
             // connection: {
             //      filename: path.join(__dirname, &#39;/content/data/ghost.db&#39;)
            },
             // debug: false
             // 将上方原 sqlite 数据库配置删掉，替换为下方配置
            client: &#39;mysql&#39;,
            connection: {
                host     : &#39;127.0.0.1&#39;,
                user     : &#39;root&#39;, 
                password : &#39;*password*&#39;, // 输入 MySQL root 账户的密码
                database : &#39;ghost&#39;, // 前面为 Ghost 创建的数据库名称
                charset  : &#39;utf8&#39;
            }
        },
        server: {
            host: &#39;0.0.0.0&#39;,
            port: &#39;2368&#39; // 推荐使用大于 5000 的端口
        }
    },
</code></pre><p>然后运行 <code>pm2 restart 0</code> 来重启 Ghost 博客，之后你的 Ghost 博客便使用 mysql 数据库来储存博客数据了</p>
<hr>
<h3 id="6、找回密码-amp-配置邮件"><a href="#6、找回密码-amp-配置邮件" class="headerlink" title="6、找回密码&amp;配置邮件"></a>6、找回密码&amp;配置邮件</h3><p>注册一个 <a href="http://www.mailgun.com" target="_blank" rel="noopener">Mailgun</a> 帐号，新增一个域名并获取 <code>SMTP credentials</code></p>
<p>编辑 <code>config.js</code> ：</p>
<pre><code>mail: {
transport: &#39;SMTP&#39;,
    options: {
        service: &#39;Mailgun&#39;,
        auth: {
            user: &#39;postmaster@sandbox0745f20b166744b5ab71b77b7cf7b8ff.mailgun.org&#39;, // 修改为你自己的 SMTP 帐号
            pass: &#39;a28a3971e3efe00d117ef466cd039ebc&#39; // 修改为你自己的密码
        }
    }
}
</code></pre><p>重启 Ghost ，访问您博客的登录页，填入邮件地址并点击 <code>Forgot?</code> ，即可收到重置密码邮件（有可能在垃圾邮件里）</p>
<p><img src="https://ooo.0o0.ooo/2016/01/16/569a32ac550b5.gif" alt="39f8b4246c410edfff754c060bff3.gif"></p>
<hr>
<h3 id="7、安装主题"><a href="#7、安装主题" class="headerlink" title="7、安装主题"></a>7、安装主题</h3><p>进入 Ghost 安装目录，并运行</p>
<pre><code>cd content/themes
</code></pre><p>下载主题或者 git clone 进当前目录</p>
<pre><code>// 例如
git clone https://github.com/ygbhf/anatole-ghost-theme.git anatole
</code></pre><p>重启 Ghost 博客，在后台 <code>General</code> 中选择你安装的主题即可</p>

        
    

    
</div>


                

                <!-- Post Comments -->
                
                    
    <div id="comment" style='padding:10px;' class="vcomment"></div>
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src="//cdn.jsdelivr.net/npm/valine/dist/Valine.min.js"></script>
<script>
    var GUEST_INFO = ['nick','mail','link'];
    var guest_info = 'nick,mail,link'.split(',').filter(function(item){
        return GUEST_INFO.indexOf(item) > -1
    });
    var notify = 'true' == true;
    var verify = 'true' == true;
    new Valine({
        el: '.vcomment',
        notify: notify,
        verify: verify,
        appId: "gEUiWMReyWo7xFtsQ3ckMeM3-gzGzoHsz",
        appKey: "K3wQfmOGxRB79vaBSILIGON9",
        placeholder: "ヾﾉ≧∀≦)o来啊，快活啊!",
        pageSize:'10',
        avatar:'identicon',
        lang:'zh-cn'
    });
</script>

                
            </div>

            <!-- Post Prev & Next Nav -->
            <nav class="material-nav mdl-color-text--grey-50 mdl-cell mdl-cell--12-col">
    <!-- Prev Nav -->
    
        <a href="/nginx-proxy-html/" id="post_nav-newer" class="prev-content">
            <button class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon mdl-color--white mdl-color-text--grey-900" role="presentation">
                <i class="material-icons">arrow_back</i>
            </button>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            新篇
        </a>
    

    <!-- Section Spacer -->
    <div class="section-spacer"></div>

    <!-- Next Nav -->
    
        <a href="/change-title/" id="post_nav-older" class="next-content">
            旧篇
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <button class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon mdl-color--white mdl-color-text--grey-900" role="presentation">
                <i class="material-icons">arrow_forward</i>
            </button>
        </a>
    
</nav>

        </div>
    </div>



                    
                        <!-- Overlay For Active Sidebar -->
<div class="sidebar-overlay"></div>

<!-- Material sidebar -->
<aside id="sidebar" class="sidebar sidebar-colored sidebar-fixed-left" role="navigation">
    <div id="sidebar-main">
        <!-- Sidebar Header -->
        <div class="sidebar-header header-cover" style="background-image: url(https://i.loli.net/2017/12/13/5a30b3e8ceb69.jpg);">
    <!-- Top bar -->
    <div class="top-bar"></div>

    <!-- Sidebar toggle button -->
    <button type="button" class="sidebar-toggle mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon" style="display: initial;" data-upgraded=",MaterialButton,MaterialRipple">
        <i class="material-icons">clear_all</i>
        <span class="mdl-button__ripple-container">
            <span class="mdl-ripple">
            </span>
        </span>
    </button>

    <!-- Sidebar Avatar -->
    <div class="sidebar-image">
        <img src="https://v5cdn.b0.upaiyun.com/avatar/5c1963a15ab57f2af68e9ecf6693fbac" alt="YJK's avatar">
    </div>

    <!-- Sidebar Email -->
    <a data-toggle="dropdown" class="sidebar-brand" href="#settings-dropdown">
        
        <b class="caret"></b>
    </a>
</div>


        <!-- Sidebar Navigation  -->
        <ul class="nav sidebar-nav">
    <!-- User dropdown  -->
    <li class="dropdown">
        <ul id="settings-dropdown" class="dropdown-menu">
            
        </ul>
    </li>

    <!-- Homepage -->
    
        <li id="sidebar-first-li">
            <a href="/">
                
                    <i class="material-icons sidebar-material-icons">home</i>
                
                主页
            </a>
        </li>
        
    

    <!-- Archives  -->
    
        <li class="dropdown">
            <a href="#" class="ripple-effect dropdown-toggle" data-toggle="dropdown">
                
                    <i class="material-icons sidebar-material-icons">inbox</i>
                
                    归档
                <b class="caret"></b>
            </a>
            <ul class="dropdown-menu">
            <li>
                <a class="sidebar_archives-link" href="/archives/2017/12/">十二月 2017<span class="sidebar_archives-count">2</span></a></li><li><a class="sidebar_archives-link" href="/archives/2017/11/">十一月 2017<span class="sidebar_archives-count">5</span></a></li><li><a class="sidebar_archives-link" href="/archives/2017/10/">十月 2017<span class="sidebar_archives-count">2</span></a></li><li><a class="sidebar_archives-link" href="/archives/2017/09/">九月 2017<span class="sidebar_archives-count">3</span></a></li><li><a class="sidebar_archives-link" href="/archives/2017/08/">八月 2017<span class="sidebar_archives-count">4</span></a></li><li><a class="sidebar_archives-link" href="/archives/2017/07/">七月 2017<span class="sidebar_archives-count">1</span></a></li><li><a class="sidebar_archives-link" href="/archives/2017/06/">六月 2017<span class="sidebar_archives-count">2</span></a></li><li><a class="sidebar_archives-link" href="/archives/2017/05/">五月 2017<span class="sidebar_archives-count">3</span></a></li><li><a class="sidebar_archives-link" href="/archives/2017/04/">四月 2017<span class="sidebar_archives-count">1</span></a></li><li><a class="sidebar_archives-link" href="/archives/2017/02/">二月 2017<span class="sidebar_archives-count">3</span></a></li><li><a class="sidebar_archives-link" href="/archives/2016/10/">十月 2016<span class="sidebar_archives-count">1</span></a></li><li><a class="sidebar_archives-link" href="/archives/2016/09/">九月 2016<span class="sidebar_archives-count">2</span></a></li><li><a class="sidebar_archives-link" href="/archives/2016/06/">六月 2016<span class="sidebar_archives-count">1</span></a></li><li><a class="sidebar_archives-link" href="/archives/2016/03/">三月 2016<span class="sidebar_archives-count">1</span></a></li><li><a class="sidebar_archives-link" href="/archives/2016/01/">一月 2016<span class="sidebar_archives-count">1</span></a></li><li><a class="sidebar_archives-link" href="/archives/2015/12/">十二月 2015<span class="sidebar_archives-count">6</span></a>
            </ul>
        </li>
        
    

    <!-- Categories  -->
    

    <!-- Pages  -->
    
        <li>
            <a href="/about" title="关于">
                
                    <i class="material-icons sidebar-material-icons">person</i>
                
                关于
            </a>
        </li>
        
    
        <li>
            <a href="/free" title="免费">
                
                    <i class="material-icons sidebar-material-icons">star-circle</i>
                
                免费
            </a>
        </li>
        
    
        <li>
            <a href="/links" title="友链">
                
                    <i class="material-icons sidebar-material-icons">link</i>
                
                友链
            </a>
        </li>
        
    

    <!-- Article Number  -->
    
</ul>


        <!-- Sidebar Footer -->
        <!--
I'm glad you use this theme, the development is no so easy, I hope you can keep the copyright, I will thank you so much.
If you still want to delete the copyrights, could you still retain the first one? Which namely "Theme Material"
It will not impact the appearance and can give developers a lot of support :)

很高兴您使用并喜欢该主题，开发不易 十分谢谢与希望您可以保留一下版权声明。
如果您仍然想删除的话 能否只保留第一项呢？即 "Theme Material"
它不会影响美观并可以给开发者很大的支持和动力。 :)
-->

<!-- Sidebar Divider -->

    <div class="sidebar-divider"></div>


<!-- Theme Material -->

    <a href="https://github.com/viosey/hexo-theme-material"  class="sidebar-footer-text-a" target="_blank">
        <div class="sidebar-text mdl-button mdl-js-button mdl-js-ripple-effect sidebar-footer-text-div" data-upgraded=",MaterialButton,MaterialRipple">
            主题 - Material
            <span class="sidebar-badge badge-circle">i</span>
        </div>
    </a>


<!-- Help & Support -->
<!--

-->

<!-- Feedback -->
<!--

-->

<!-- About Theme -->
<!--

-->

    </div>

    <!-- Sidebar Image -->
    

</aside>

                    

                    
                        <!-- Footer Top Button -->
                        <div id="back-to-top" class="toTop-wrap">
    <a href="#top" class="toTop">
        <i class="material-icons footer_top-i">expand_less</i>
    </a>
</div>

                    

                    <!--Footer-->
<footer class="mdl-mini-footer" id="bottom">
    
        <!-- Paradox Footer Left Section -->
        <div class="mdl-mini-footer--left-section sns-list">
    <!-- Twitter -->
    
        <a href="https://twitter.com/tayuo" target="_blank">
            <button class="mdl-mini-footer--social-btn social-btn footer-sns-twitter">
                <span class="visuallyhidden">Twitter</span>
            </button><!--
     --></a>
    

    <!-- Facebook -->
    

    <!-- Google + -->
    

    <!-- Weibo -->
    
        <a href="http://weibo.com/tayuo" target="_blank">
            <button class="mdl-mini-footer--social-btn social-btn footer-sns-weibo">
                <span class="visuallyhidden">Weibo</span>
            </button><!--
     --></a>
    

    <!-- Instagram -->
    
        <a href="https://instagram.com/tayuo" target="_blank">
            <button class="mdl-mini-footer--social-btn social-btn footer-sns-instagram">
                <span class="visuallyhidden">Instagram</span>
            </button><!--
     --></a>
    

    <!-- Tumblr -->
    

    <!-- Github -->
    
        <a href="https://github.com/ygbhf" target="_blank">
            <button class="mdl-mini-footer--social-btn social-btn footer-sns-github">
                <span class="visuallyhidden">Github</span>
            </button><!--
     --></a>
    

    <!-- LinkedIn -->
    

    <!-- Zhihu -->
    

    <!-- Bilibili -->
    

    <!-- Telegram -->
    
        <a href="https://t.me/fakeuncle" target="_blank">
            <button class="mdl-mini-footer--social-btn social-btn footer-sns-telegram">
                <span class="visuallyhidden">Telegram</span>
            </button><!--
     --></a>
    
    
    <!-- V2EX -->
    
</div>


        <!--Copyright-->
        <div id="copyright">
            Copyright&nbsp;©<script type="text/javascript">var fd = new Date();document.write("&nbsp;" + fd.getFullYear() + "&nbsp;");</script>独立世界
            
        </div>

        <!-- Paradox Footer Right Section -->

        <!--
        I am glad you use this theme, the development is no so easy, I hope you can keep the copyright.
        It will not impact the appearance and can give developers a lot of support :)

        很高兴您使用该主题，开发不易，希望您可以保留一下版权声明。
        它不会影响美观并可以给开发者很大的支持。 :)
        -->

        <div class="mdl-mini-footer--right-section">
            <div>
                <div class="footer-develop-div">Powered by <a href="https://hexo.io" target="_blank" class="footer-develop-a">Hexo</a></div>
                <div class="footer-develop-div">Theme - <a href="https://github.com/viosey/hexo-theme-material" target="_blank" class="footer-develop-a">Material</a></div>
            </div>
        </div>
    
</footer>


                    <!-- Import JS File -->

    <script>lsloader.load("lazyload_js","https://cdn.jsdelivr.net/gh/viosey/hexo-theme-material/source/js/lazyload.min.js", true)</script>



    <script>lsloader.load("js_js","https://cdn.jsdelivr.net/gh/viosey/hexo-theme-material/source/js/js.min.js", true)</script>



    <script>lsloader.load("np_js","https://cdn.jsdelivr.net/npm/nprogress@0.2.0/nprogress.min.js", true)</script>


<script type="text/ls-javascript" id="NProgress-script">
    NProgress.configure({
        showSpinner: true
    });
    NProgress.start();
    $('#nprogress .bar').css({
        'background': '#29d'
    });
    $('#nprogress .peg').css({
        'box-shadow': '0 0 10px #29d, 0 0 15px #29d'
    });
    $('#nprogress .spinner-icon').css({
        'border-top-color': '#29d',
        'border-left-color': '#29d'
    });
    setTimeout(function() {
        NProgress.done();
        $('.fade').removeClass('out');
    }, 800);
</script>





    <!-- Leancloud -->
    <script src="https://cdn1.lncld.net/static/js/av-core-mini-0.6.1.js"></script>
    <script>
        AV.initialize('gEUiWMReyWo7xFtsQ3ckMeM3-gzGzoHsz', 'K3wQfmOGxRB79vaBSILIGON9');
    </script>
    <script type="text/ls-javascript" id="leancloud-views-script">
    function showTime(Counter) {
        var query = new AV.Query(Counter);
        $('.leancloud-views_num').each(function() {
            var url = $(this).attr('id').trim();
            query.equalTo('url', url);
            query.find({
                success: function(results) {
                    if (results.length === 0) {
                        var content = '0 ' + $(document.getElementById(url)).text();
                        $(document.getElementById(url)).text(content);
                        return;
                    }
                    for (var i = 0; i < results.length; i++) {
                        var object = results[i];
                        var content = object.get('time') + ' ' + $(document.getElementById(url)).text();
                        $(document.getElementById(url)).text(content);
                    }
                },
                error: function(object, error) {
                    console.log('Error: ' + error.code + ' ' + error.message);
                }
            });
        });
    }

    function addCount(Counter) {
      var Counter = AV.Object.extend('Counter');
      url = $('.leancloud-views_num').attr('id').trim();
      title = $('.leancloud-views_num').attr('data-flag-title').trim();
      var query = new AV.Query(Counter);
      query.equalTo('url', url);
      query.find({
          success: function(results) {
            if (results.length > 0) {
                var counter = results[0];
                counter.fetchWhenSave(true);
                counter.increment('time');
                counter.save(null, {
                    success: function(counter) {
                        var content =  counter.get('time') + ' ' + $(document.getElementById(url)).text();
                        $(document.getElementById(url)).text(content);
                    },
                    error: function(counter, error) {
                        console.log('Failed to save Visitor num, with error message: ' + error.message);
                    }
                });
            } else {
              var newcounter = new Counter();
              newcounter.set('title', title);
              newcounter.set('url', url);
              newcounter.set('time', 1);
              newcounter.save(null, {
                  success: function(newcounter) {
                      console.log('newcounter.get(\'time\')='+newcounter.get('time'));
                      var content = newcounter.get('time') + ' ' + $(document.getElementById(url)).text();
                      $(document.getElementById(url)).text(content);
                  },
                  error: function(newcounter, error) {
                      console.log('Failed to create');
                  }
              });
            }
        },
        error: function(error) {
            console.log('Error:' + error.code + ' ' + error.message);
        }
      });
    }
    $(function() {
        var Counter = AV.Object.extend('Counter');
        if ($('.leancloud-views_num').length === 1) {
            addCount(Counter);
        } else if ($('.post-title-link').length > 1) {
            showTime(Counter);
        }
    });
</script>






   





<!-- UC Browser Compatible -->
<script>
	var agent = navigator.userAgent.toLowerCase();
	if(agent.indexOf('ucbrowser')>0) {
		document.write('<link rel="stylesheet" href="/css/uc.css">');
	   alert('由于 UC 浏览器使用极旧的内核，而本网站使用了一些新的特性。\n为了您能更好的浏览，推荐使用 Chrome 或 Firefox 浏览器。');
	}
</script>

<!-- Import prettify js  -->

    
        
            <script>lsloader.load("prettify_js","https://cdn.jsdelivr.net/gh/viosey/hexo-theme-material/source/js/prettify.min.js", true)</script>
        
    



<!-- Window Load -->
<!-- add class for prettify -->
<script type="text/ls-javascript" id="window-load">
    $(window).on('load', function() {
        // Post_Toc parent position fixed
        $('.post-toc-wrap').parent('.mdl-menu__container').css('position', 'fixed');
    });

    
        
            $(function() {
                $('pre').addClass('prettyprint linenums').attr('style', 'overflow:auto;');
                prettyPrint();
                })
        
    
    
</script>

<!-- MathJax Load-->


<!-- Bing Background -->


<script type="text/ls-javascript" id="lazy-load">
    // Offer LazyLoad
    queue.offer(function(){
        $('.lazy').lazyload({
            effect : 'show'
        });
    });

    // Start Queue
    $(document).ready(function(){
        setInterval(function(){
            queue.execNext();
        },200);
    });
</script>

<!-- Custom Footer -->



<script>
    (function(){
        var scriptList = document.querySelectorAll('script[type="text/ls-javascript"]')

        for (var i = 0; i < scriptList.length; ++i) {
            var item = scriptList[i];
            lsloader.runInlineScript(item.id,item.id);
        }
    })()
console.log('\n %c © Material Theme | Version: 1.5.2 | https://github.com/viosey/hexo-theme-material %c \n', 'color:#455a64;background:#e0e0e0;padding:5px 0;border-top-left-radius:5px;border-bottom-left-radius:5px;', 'color:#455a64;background:#e0e0e0;padding:5px 0;border-top-right-radius:5px;border-bottom-right-radius:5px;');
</script>

                </main>
            </div>
        </body>
    
<script>var OriginTitile=document.title;var st;document.addEventListener('visibilitychange',function(){if(document.hidden){document.title="呀，崩溃了 (´O｀)";clearTimeout(st);console.log('hide');}else{document.title='呀，又好了 ｡◕‿◕｡ ';console.log('show');st=setTimeout(function(){document.title=OriginTitile;},3000);console.log('endChange=');}});</script>
<script>var _hmt =_hmt ||[];(function() {var hm =document.createElement("script");hm.src ="https://hm.baidu.com/hm.js?02443f8f3608593eba77294d5c5f0a21";var s =document.getElementsByTagName("script")[0];s.parentNode.insertBefore(hm,s);})();</script>
</html>
